<!--背景色组件-->
<template>
  <div class="item-setting">
    <div class="header-info">
      <el-divider content-position="left">标题</el-divider>
    </div>

    <div class="editor-item">
      <el-form-item label="字号">
        <el-input-number
            :min="0"
            size="small"
            v-model="optionsInfo['fontsize']"
        />
      </el-form-item>

      <el-form-item label="颜色">
        <el-color-picker
            show-alpha
            size="small"
            :predefine="predefineColors"
            v-model="optionsInfo['color']"
        />
      </el-form-item>

      <el-form-item label="粗细设置">
        <el-select v-model="optionsInfo['fontWeight']" placeholder="请选择">
          <el-option
              v-for="item in fontWeightOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="背景色">
        <el-color-picker
            show-alpha
            size="small"
            :predefine="predefineColors"
            v-model="optionsInfo.backgroundColor"
        />
      </el-form-item>
    </div>
  </div>
</template>

<script>
import constantDic from "@/utils/vue-i18n/lang/zh-CN";
import * as types from "@c/public/form-designer/devType/datas-types";
export default {
  name: "background-editor",

  componentName: "background-editor",

  mixins: [],

  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object,
  },

  data() {
    return {
      constantDic: constantDic,
      optionsInfo:Object(),
      predefineColors: types['predefineColors'],
      fontWeightOptions: types['fontWeightOptions'],
    }
  },

  watch: {
    optionModel: {
      handler: function (val) {
        let key = val.config;
        this.optionsInfo = (val[key]);
      },
      deep: true,
      immediate: true
    }
  }
}
</script>
